package com.zxxy.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

/**
 * 1.导入依赖
 * 2.编写配置
 */


@Configuration
public class GulimallElasticSearchConfig {

    public static final RequestOptions COMMON_OPTIONS = RequestOptions.DEFAULT;

    public RestHighLevelClient esRestClient() {

        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("192.168.23.94", 9200, "http")
                        //, new HttpHost("localhost",9201,"http")
                )
        );
        return client;
    }

}
